/**
 * 
 */
package calendarInterface2;

import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import calendarEventManager.CEMListColor;

/**
 * @author Mohamed Ali Ayed
 *
 */
@SuppressWarnings("serial")
public abstract class FrameAgenda extends JFrame{
	JLabel lName;
	JTextField tName;
	JLabel lColor;
	JComboBox<String> CBColor;
	protected JButton bSaveAgenda;
	protected JButton bCancelAgenda;
	protected JPanel pAgenda;
	
	public FrameAgenda(){
		super();
		buildFrame();
	}

	public void buildPanel(JPanel panelAddAgenda) {
		panelAddAgenda.setLayout(new GridLayout(3, 2));
		lName = new JLabel("Name",JLabel.CENTER);
		tName = new JTextField("");
		lColor = new JLabel("Color",JLabel.CENTER);
		CBColor = new JComboBox<String>();
		bSaveAgenda = new JButton("Save");
		bCancelAgenda = new JButton("Cancel");		
		
		this.getContentPane();
		panelAddAgenda.add(lName);
		panelAddAgenda.add(tName);
		panelAddAgenda.add(lColor);
		addColorAgenda();
		panelAddAgenda.add(CBColor);
		panelAddAgenda.add(bSaveAgenda);
		panelAddAgenda.add(bCancelAgenda);
		// http://www.siteduzero.com/tutoriel-3-10526-les-listes-l-objet-jcombobox.html
		
	}

	private void buildFrame() {
		setResizable(false); //prevent resizable
		pAgenda= new JPanel();
		 buildPanel(pAgenda);
	}
	
	
	// add color to JComboBox<String> CBColor
	public void addColorAgenda (){
		CEMListColor listColor = new CEMListColor();
		for(int i=0; i<listColor.size();i++){
			CBColor.addItem(listColor.get(i));	
		}
		listColor=null;
	}
	
}
